package hashchainutil.common;

import javax.servlet.http.HttpServletRequest;

/**
 * @program: hashchain-spring
 * @description:
 * @author: Mr.Li
 * @create: 2020-10-30 17:51
 **/

public class PathUtil {
    /**
     * @author
     * @description 得到项目的根目录的绝对路径
     */
    public static String getPath(HttpServletRequest request){
        String path = request.getSession().getServletContext().getRealPath("/");//表示到项目的根目录下，要是想到目录下的子文件夹，修改"/"即可
        path = path.replaceAll("\\\\", "/");
        return path;
    }

    public static void main(String[] args) {
        System.out.println( System.getProperty("user.dir"));
    }

}
